home *** CD-ROM | disk | FTP | other *** search
/ MacWorld Secrets (4th Edition) / Mac Secrets CD 4th Ed.toast / Shareware & Freeware / KeyQuencer 1.2.2 / Developer’s toolkit / Common code / KQPPCGlue.h < prev   
Text File  |  1995-12-16  |  12KB  |  271 lines

  1. // =============================================================================
  2. // KEYQUENCER GLUE ROUTINE DESCRIPTORS FOR PPC - VERSION 1.2.2 - DECEMBER 1995
  3. // By Alessandro Levi Montalcini <alm@torino.alpcom.it>
  4. // ©1994-96 Binary Software, Inc. <binarysoft@eworld.com>
  5. // This text looks best in monaco 9 font, 4 spaces per tab, no wrapping
  6. //==============================================================================
  7. // This file contains the procInfos and macros needed to call some of the KQ
  8. // glue routines from PowerPC code. You may build your own procInfos if you need
  9. // to call a glue routine that's not listed here.
  10. //==============================================================================
  11.  
  12. #pragma once
  13. #ifndef _H_kqppcglue
  14. #define _H_kqppcglue
  15.  
  16. //==============================================================================
  17.  
  18. enum {
  19.     uppKQStopSequenceProcInfo = kPascalStackBased,
  20.     
  21.     uppKQExecuteScriptProcInfo = kPascalStackBased
  22.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  23.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))),
  24.     
  25.     uppKQMacroRunningProcInfo = kPascalStackBased
  26.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))),
  27.     
  28.     uppKQAppleEventsBusyProcInfo = kPascalStackBased
  29.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))),
  30.     
  31.     uppKQCountMacrosProcInfo = kPascalStackBased
  32.         | RESULT_SIZE(SIZE_CODE(sizeof(short))),
  33.     
  34.     uppKQBuildSortedIndexProcInfo = kPascalStackBased
  35.         | RESULT_SIZE(SIZE_CODE(sizeof(Ptr))),
  36.     
  37.     uppKQGetMacroInfoProcInfo = kPascalStackBased
  38.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  39.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned char*)))
  40.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short*)))
  41.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short*))),
  42.         
  43.     uppKQGetIndexedMacroProcInfo = kPascalStackBased
  44.         | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  45.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))),
  46.     
  47.     uppKQGetNamedMacroProcInfo = kPascalStackBased
  48.         | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  49.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr31Param))),
  50.     
  51.     uppKQLastMacroErrorProcInfo = kPascalStackBased
  52.         | RESULT_SIZE(SIZE_CODE(sizeof(short))),
  53.     
  54.     uppKQGetVariableProcInfo = kPascalStackBased
  55.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  56.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr255Param)))
  57.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(StringPtr))),
  58.     
  59.     uppKQSetVariableProcInfo = kPascalStackBased
  60.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  61.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr255Param)))
  62.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(ConstStr255Param))),
  63.     
  64.     uppKQClearVariableProcInfo = kPascalStackBased
  65.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  66.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ConstStr255Param))),
  67.     
  68.     uppKQCountVariablesProcInfo = kPascalStackBased
  69.         | RESULT_SIZE(SIZE_CODE(sizeof(long))),
  70.     
  71.     uppKQGetIndexedVariableProcInfo = kPascalStackBased
  72.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  73.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  74.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(StringPtr)))
  75. };
  76.  
  77. //==============================================================================
  78.  
  79. #if GENERATINGCFM    // PowerPC or 68K Code Fragment Mgr
  80.  
  81. typedef UniversalProcPtr KQStopSequenceUPP;
  82. #define CallKQStopSequenceProc(userRoutine) \
  83.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQStopSequenceProcInfo)
  84. #define NewKQStopSequenceProc(userRoutine) \
  85.         (KQStopSequenceUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQStopSequenceProcInfo, kM68kISA)
  86.  
  87. typedef UniversalProcPtr KQExecuteScriptUPP;
  88. #define CallKQExecuteScriptProc(userRoutine, macro) \
  89.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQExecuteScriptProcInfo, (macro))
  90. #define NewKQExecuteScriptProc(userRoutine) \
  91.         (KQExecuteScriptUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQExecuteScriptProcInfo, kM68kISA)
  92.  
  93. typedef UniversalProcPtr KQMacroRunningUPP;
  94. #define CallKQMacroRunningProc(userRoutine) \
  95.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQMacroRunningProcInfo)
  96. #define NewKQMacroRunningProc(userRoutine) \
  97.         (KQMacroRunningUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQMacroRunningProcInfo, kM68kISA)
  98.  
  99. typedef UniversalProcPtr KQAppleEventsBusyUPP;
  100. #define CallKQAppleEventsBusyProc(userRoutine) \
  101.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQAppleEventsBusyProcInfo)
  102. #define NewKQAppleEventsBusyProc(userRoutine) \
  103.         (KQAppleEventsBusyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQAppleEventsBusyProcInfo, kM68kISA)
  104.  
  105. typedef UniversalProcPtr KQCountMacrosUPP;
  106. #define CallKQCountMacrosProc(userRoutine) \
  107.         (short)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQCountMacrosProcInfo)
  108. #define NewKQCountMacrosProc(userRoutine) \
  109.         (KQCountMacrosUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQCountMacrosProcInfo, kM68kISA)
  110.  
  111. typedef UniversalProcPtr KQBuildSortedIndexUPP;
  112. #define CallKQBuildSortedIndexProc(userRoutine) \
  113.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQBuildSortedIndexProcInfo)
  114. #define NewKQBuildSortedIndexProc(userRoutine) \
  115.         (KQBuildSortedIndexUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQBuildSortedIndexProcInfo, kM68kISA)
  116.  
  117. typedef UniversalProcPtr KQGetMacroInfoUPP;
  118. #define CallKQGetMacroInfoProc(userRoutine, macroIndex, macroName, keyCode, modifiers) \
  119.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQGetMacroInfoProcInfo, (macroIndex), (macroName), (keyCode), (modifiers))
  120. #define NewKQGetMacroInfoProc(userRoutine) \
  121.         (KQGetMacroInfoUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQGetMacroInfoProcInfo, kM68kISA)
  122.  
  123. typedef UniversalProcPtr KQGetIndexedMacroUPP;
  124. #define CallKQGetIndexedMacroProc(userRoutine, macroIndex) \
  125.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQGetIndexedMacroProcInfo, (macroIndex))
  126. #define NewKQGetIndexedMacroProc(userRoutine) \
  127.         (KQGetIndexedMacroUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQGetIndexedMacroProcInfo, kM68kISA)
  128.  
  129. typedef UniversalProcPtr KQGetNamedMacroUPP;
  130. #define CallKQGetNamedMacroProc(userRoutine, macroName) \
  131.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQGetNamedMacroProcInfo, (macroName))
  132. #define NewKQGetNamedMacroProc(userRoutine) \
  133.         (KQGetNamedMacroUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQGetNamedMacroProcInfo, kM68kISA)
  134.  
  135. typedef UniversalProcPtr KQLastMacroErrorUPP;
  136. #define CallKQLastMacroErrorProc(userRoutine) \
  137.         (short)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQLastMacroErrorProcInfo)
  138. #define NewKQLastMacroErrorProc(userRoutine) \
  139.         (KQLastMacroErrorUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQLastMacroErrorProcInfo, kM68kISA)
  140.  
  141. typedef UniversalProcPtr KQGetVariableUPP;
  142. #define CallKQGetVariableProc(userRoutine, variableName, variableValue) \
  143.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQGetVariableProcInfo, (variableName), (variableValue))
  144. #define NewKQGetVariableProc(userRoutine) \
  145.         (KQGetVariableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQGetVariableProcInfo, kM68kISA)
  146.  
  147. typedef UniversalProcPtr KQSetVariableUPP;
  148. #define CallKQSetVariableProc(userRoutine, variableName, variableValue) \
  149.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQSetVariableProcInfo, (variableName), (variableValue))
  150. #define NewKQSetVariableProc(userRoutine) \
  151.         (KQSetVariableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQSetVariableProcInfo, kM68kISA)
  152.  
  153. typedef UniversalProcPtr KQClearVariableUPP;
  154. #define CallKQClearVariableProc(userRoutine, variableName) \
  155.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQClearVariableProcInfo, (variableName))
  156. #define NewKQClearVariableProc(userRoutine) \
  157.         (KQClearVariableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQClearVariableProcInfo, kM68kISA)
  158.  
  159. typedef UniversalProcPtr KQCountVariablesUPP;
  160. #define CallKQCountVariablesProc(userRoutine) \
  161.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQCountVariablesProcInfo)
  162. #define NewKQCountVariablesProc(userRoutine) \
  163.         (KQCountVariablesUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQCountVariablesProcInfo, kM68kISA)
  164.  
  165. typedef UniversalProcPtr KQGetIndexedVariableUPP;
  166. #define CallKQGetIndexedVariableProc(userRoutine, variableIndex, variableValue) \
  167.         (Handle)CallUniversalProc((UniversalProcPtr)(userRoutine), uppKQGetIndexedVariableProcInfo, (variableIndex), (variableValue))
  168. #define NewKQGetIndexedVariableProc(userRoutine) \
  169.         (KQGetIndexedVariableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppKQGetIndexedVariableProcInfo, kM68kISA)
  170.  
  171. #else    // 68K, no Code Fragment Mgr
  172.  
  173. typedef pascal void (*KQStopSequenceUPP)(void);
  174. #define CallKQStopSequenceProc(userRoutine) \
  175.         (*(userRoutine))()
  176. #define NewKQStopSequenceProc(userRoutine) \
  177.         (KQStopSequenceUPP)(userRoutine)
  178.  
  179. typedef pascal short (*KQExecuteScriptUPP)(Handle macro);
  180. #define CallKQExecuteScriptProc(userRoutine, macro) \
  181.         (*(userRoutine))(macro)
  182. #define NewKQExecuteScriptProc(userRoutine) \
  183.         (KQExecuteScriptUPP)(userRoutine)
  184.  
  185. typedef pascal Boolean (*KQMacroRunningUPP)(void);
  186. #define CallKQMacroRunningProc(userRoutine) \
  187.         (*(userRoutine))()
  188. #define NewKQMacroRunningProc(userRoutine) \
  189.         (KQMacroRunningUPP)(userRoutine)
  190.  
  191. typedef pascal Boolean (*KQAppleEventsBusyUPP)(void);
  192. #define CallKQAppleEventsBusyProc(userRoutine) \
  193.         (*(userRoutine))()
  194. #define NewKQAppleEventsBusyProc(userRoutine) \
  195.         (KQAppleEventsBusyUPP)(userRoutine)
  196.  
  197. typedef pascal short (*KQCountMacrosUPP)(void);
  198. #define CallKQCountMacrosProc(userRoutine) \
  199.         (*(userRoutine))()
  200. #define NewKQCountMacrosProc(userRoutine) \
  201.         (KQCountMacrosUPP)(userRoutine)
  202.  
  203. typedef pascal Ptr (*KQBuildSortedIndexUPP)(void);
  204. #define CallKQBuildSortedIndexProc(userRoutine) \
  205.         (*(userRoutine))()
  206. #define NewKQBuildSortedIndexProc(userRoutine) \
  207.         (KQBuildSortedIndexUPP)(userRoutine)
  208.  
  209. typedef pascal void (*KQGetMacroInfoUPP)(short macroIndex, unsigned char *macroName, short *keyCode, short *modifiers);
  210. #define CallKQGetMacroInfoProc(userRoutine, macroIndex, macroName, keyCode, modifiers) \
  211.         (*(userRoutine))((macroIndex), (macroName), (keyCode), (modifiers))
  212. #define NewKQGetMacroInfoProc(userRoutine) \
  213.         (KQGetMacroInfoUPP)(userRoutine)
  214.  
  215. typedef pascal Handle (*KQGetIndexedMacroUPP)(short macroIndex);
  216. #define CallKQGetIndexedMacroProc(userRoutine, macroIndex) \
  217.         (*(userRoutine))(macroIndex)
  218. #define NewKQGetIndexedMacroProc(userRoutine) \
  219.         (KQGetIndexedMacroUPP)(userRoutine)
  220.  
  221. typedef pascal Handle (*KQGetNamedMacroUPP)(ConstStr31Param macroName);
  222. #define CallKQGetNamedMacroProc(userRoutine, macroName) \
  223.         (*(userRoutine))(macroName)
  224. #define NewKQGetNamedMacroProc(userRoutine) \
  225.         (KQGetNamedMacroUPP)(userRoutine)
  226.  
  227. typedef pascal short (*KQLastMacroErrorUPP)(void);
  228. #define CallKQLastMacroErrorProc(userRoutine) \
  229.         (*(userRoutine))()
  230. #define NewKQLastMacroErrorProc(userRoutine) \
  231.         (KQLastMacroErrorUPP)(userRoutine)
  232.  
  233. typedef pascal long (*KQGetVariableUPP)(ConstStr255Param variableName, StringPtr variableValue);
  234. #define CallKQGetVariableProc(userRoutine, variableName, variableValue) \
  235.         (*(userRoutine))((variableName), (variableValue))
  236. #define NewKQGetVariableProc(userRoutine) \
  237.         (KQGetVariableUPP)(userRoutine)
  238.  
  239. typedef pascal long (*KQSetVariableUPP)(ConstStr255Param variableName, ConstStr255Param variableValue);
  240. #define CallKQSetVariableProc(userRoutine, variableName, variableValue) \
  241.         (*(userRoutine))((variableName), (variableValue))
  242. #define NewKQSetVariableProc(userRoutine) \
  243.         (KQSetVariableUPP)(userRoutine)
  244.  
  245. typedef pascal long (*KQClearVariableUPP)(ConstStr255Param variableName);
  246. #define CallKQClearVariableProc(userRoutine, variableName) \
  247.         (*(userRoutine))(variableName)
  248. #define NewKQClearVariableProc(userRoutine) \
  249.         (KQClearVariableUPP)(userRoutine)
  250.  
  251. typedef pascal long (*KQCountVariablesUPP)(void);
  252. #define CallKQCountVariablesProc(userRoutine) \
  253.         (*(userRoutine))()
  254. #define NewKQCountVariablesProc(userRoutine) \
  255.         (KQCountVariablesUPP)(userRoutine)
  256.  
  257. typedef pascal long (*KQGetIndexedVariableUPP)(long variableIndex, StringPtr variableValue);
  258. #define CallKQGetIndexedVariableProc(userRoutine, variableIndex, variableValue) \
  259.         (*(userRoutine))((variableIndex), (variableValue))
  260. #define NewKQGetIndexedVariableProc(userRoutine) \
  261.         (KQGetIndexedVariableUPP)(userRoutine)
  262.  
  263.  
  264. #endif    // GENERATINGCFM
  265.  
  266. //==============================================================================
  267.  
  268. #endif    // _H_kqppcglue
  269.  
  270. //==============================================================================
  271.